import { storage } from "@/utils/storage"
import service from "."
import type { ApiResponse } from "./type"

interface CheckToken {
  message: string
  code: number
}

export const checkTokenIsExpired = (): Promise<ApiResponse<CheckToken>> => {
  try {
    const token = storage.get("token") || ""
    return service.post<ApiResponse<CheckToken>>("/checkTokenIsExpired", {
      token
    })
  } catch (error) {
    return Promise.reject(error)
  }
}
